package com.sx.fams.country.biz.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sx.fams.country.biz.ICountryBiz;
import com.sx.fams.country.dao.ICountryDao;
import com.sx.fams.country.entity.CountryEntity;
import com.sx.fams.country.entity.CountryTaskEntity;
import com.sx.feesunit.exception.SXException;

public class CountryBiz implements ICountryBiz {
	private Log log = LogFactory.getLog(this.getClass());
	private ICountryDao countrydao;
	
	/* (non-Javadoc)
	 * @see com.sx.fams.country.biz.ICountryBiz#insertCountryTask(com.sx.fams.country.entity.CountryTaskEntity)
	 */
	public Integer insertCountryTask(CountryTaskEntity cte) {
		Integer id = null;
		try {
			id = countrydao.insertCountryTask(cte);
		} catch (Exception e) {
			log.error("插入关联任务和国家信息失败请查明原因!",e);
		}
		return id;
	}

	/**
	 *获取国家和地区信息 
	 **/
	public List<CountryEntity> findCoutryInfos(String queryname,CountryEntity country) throws Exception{
		List<CountryEntity> list = new ArrayList<CountryEntity>();
		try {
			list = countrydao.findCoutryInfos(queryname, country);
		} catch (Exception e) {
			log.error("获取国家和地区信息",e);
			throw new SXException(e);
		}
		return list;
	}
	
	/**
	 *获取国家和地区信息数据信息
	 **/
	public String findCountryInfosCounts(String queryname,CountryEntity country) throws Exception{
		String str = "";
		try {
			str = countrydao.findCountryInfosCounts(queryname, country);
		} catch (Exception e) {
			log.error("获取国家和地区信息",e);
			throw new SXException(e);
		}
		return str;
	}
	
	/**
	 * @return the countrydao
	 */
	public ICountryDao getCountrydao() {
		return countrydao;
	}
	/**
	 * @param countrydao the countrydao to set
	 */
	public void setCountrydao(ICountryDao countrydao) {
		this.countrydao = countrydao;
	}
	
}
